package com.ruoyi.ora.service.impl;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.ora.domain.VoiceStory;
import com.ruoyi.ora.mapper.VoiceStoryMapper;
import com.ruoyi.ora.service.IVoiceStoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 录音故事Service业务层处理
 * 
 * @author liuwp
 * @date 2025-04-10
 */
@Service
public class VoiceStoryServiceImpl implements IVoiceStoryService 
{
    @Autowired
    private VoiceStoryMapper voiceStoryMapper;

    /**
     * 查询录音故事
     * 
     * @param id 录音故事主键
     * @return 录音故事
     */
    @Override
    public VoiceStory selectVoiceStoryById(Long id)
    {
        return voiceStoryMapper.selectVoiceStoryById(id);
    }

    /**
     * 查询录音故事列表
     * 
     * @param voiceStory 录音故事
     * @return 录音故事
     */
    @Override
    public List<VoiceStory> selectVoiceStoryList(VoiceStory voiceStory)
    {
        return voiceStoryMapper.selectVoiceStoryList(voiceStory);
    }

    @Override
    public List<VoiceStory> selectVoiceStoryListCollection(VoiceStory voiceStory) {
        return voiceStoryMapper.selectVoiceStoryListCollection(voiceStory);
    }

    @Override
    public List<VoiceStory> selectVoiceStoryListDeviceUser(VoiceStory voiceStory) {
        return voiceStoryMapper.selectVoiceStoryListDeviceUser(voiceStory);
    }

    /**
     * 根据业务主键查询一条记录：录音故事
     *
     * @param voiceStory 录音故事
     * @return 录音故事
     */
    @Override
    public VoiceStory selectOneVoiceStory(VoiceStory voiceStory)
    {
        return voiceStoryMapper.selectOneVoiceStory(voiceStory);
    }

    /**
     * 新增录音故事
     * 
     * @param voiceStory 录音故事
     * @return 结果
     */
    @Override
    public int insertVoiceStory(VoiceStory voiceStory)
    {
        voiceStory.setCreateTime(DateUtils.getNowDate());
        return voiceStoryMapper.insertVoiceStory(voiceStory);
    }

    /**
     * 修改录音故事
     * 
     * @param voiceStory 录音故事
     * @return 结果
     */
    @Override
    public int updateVoiceStory(VoiceStory voiceStory)
    {
        return voiceStoryMapper.updateVoiceStory(voiceStory);
    }

    @Override
    public int updateVoiceStoryCondition(VoiceStory voiceStory, VoiceStory voiceStoryCondition)
    {
        return voiceStoryMapper.updateVoiceStoryCondition(voiceStory, voiceStoryCondition);
    }

    /**
     * 批量删除录音故事
     * 
     * @param ids 需要删除的录音故事主键
     * @return 结果
     */
    @Override
    public int deleteVoiceStoryByIds(Long[] ids)
    {
        return voiceStoryMapper.deleteVoiceStoryByIds(ids);
    }

    /**
     * 删除录音故事信息
     * 
     * @param id 录音故事主键
     * @return 结果
     */
    @Override
    public int deleteVoiceStoryById(Long id)
    {
        return voiceStoryMapper.deleteVoiceStoryById(id);
    }

    /**
     * 条件删除录音故事
     *
     * @param voiceStory 录音故事
     * @return 结果
     */
    @Override
    public int deleteVoiceStoryByCondition(VoiceStory voiceStory)
    {
        return voiceStoryMapper.deleteVoiceStoryByCondition(voiceStory);
    }

}
